import request from '@/config/axios'


export interface ResourcesBaseVO {
  id: number | undefined
  title: string
  allTitle: string
  seriesTitles: string
  author: string
  authorIntro: string
  editor: string
  publish: string
  publishTime: Date
  publishPlace: string
  catalogue: string
  preface: string
  contentIntro: string
  abstracts: string
  isbn: string
  language: string
  keyword: string
  documentType: string
  subcategory: string
  productFeatures: string
  price: number | undefined
  evaluationNumber: number | undefined
  peopleBuy: number | undefined
  sellersNumber: number | undefined
  packages: string
  brand: string
  productCode: string
  isSet: string
  format: string
  paper: string
  collectionInformation: string
  editorRecommendations: string
  pages: number | undefined
  words: number | undefined
  edition: number | undefined
  version: string
  additionalVersion: string
  illustrationUrl: string
  imageUrl: string
  pageUrl: string
  dataSource: string
  dataType: string
  dataStatus: string
  createBy: string
  updateBy: string
  createTime:Date
  updateTime:Date
}



export interface formalResourceVO {
  ids: number | undefined
  createTimes:Date
}



// 创建所有资源信息
export const createResources=(data: ResourcesBaseVO)=>{
  return request.post({
    url: '/error-resources/create',
    data
  })
}

// 更新所有资源信息
export const updateResources=(data: ResourcesBaseVO)  =>{
  return request.put({
    url: '/error-resources/update',
    data: data
  })
}

// 删除所有资源信息
export const deleteResources=(id: number) =>{
  return request.delete({
    url: '/error-resources/delete?id=' + id
  })
}

// 批量删除参数
export const deleteResourcesList = (ids: Array<number | undefined>) => {
  return request.delete({ url: '/error-resources/deleteIds?ids=' + ids })
}

// 获得所有资源信息
export const getResources=(id: number) =>{
  return request.get({
    url: '/error-resources/get?id=' + id
  })
}

// 获得所有资源信息分页
export const getResourcesPage=(params: PageParam)  =>{
  return request.get({
    url: '/error-resources/page',
    params
  })
}

// 导出所有资源信息 Excel
export const exportResourcesExcel=(params) => {
  return request.download({
    url: '/error-resources/export-excel',
    params
  })
}



// 资源入库
export const addFormalResources=(params: formalResourceVO) => {
  return request.get({
    url: '/error-resources/addFormalResources',
    params
  })
}
